package com.goomba.filter;

import com.goomba.demo.contants.Commons;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.message.Message;

import java.nio.charset.StandardCharsets;

public class Producer {

    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("filter_producer_group");

        producer.setNamesrvAddr(Commons.nameSrvAddr);

        producer.start();

        for (int i = 0; i < 3; i++) {

            for (int j = 0; j < 10; j++) {

                Message message = new Message("FilterTopic", "tag" + i, ("msg" + (i * 10 + j + 1)).getBytes(StandardCharsets.UTF_8));

                message.putUserProperty("index", (i * 10 + j + 1) + "");

                producer.send(message);
            }
        }

        producer.shutdown();


    }


}
